<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../../common/include.inc.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);" action="admin/user/list"
		method="post">
	<input type="hidden" name="pageNum" value="${page.pageNo }" />
	<input type="hidden" name="numPerPage" value="${page.pageSize }" />
	<input type="hidden" name="orderField" value="" />
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>用户名：</td>
					<td><input type="text" name="userName" value="${page.condition.userName }" /></td>

					<td>性别：</td>
					<td><select name="sex">
							<option value="">未选择</option>
							<option value="男" <c:if test="${page.condition.sex =='男'}">selected</c:if>>男</option>
							<option value="女" <c:if test="${page.condition.sex =='女'}">selected</c:if>>女</option>
					</select></td>
					<td>年龄：</td>
					<td><input type="text" name="ageStart" value="${page.condition.ageStart }" /> - <input
						type="text" name="ageEnd" value="${page.condition.ageEnd }" /></td>
					<td>昵称：</td>
					<td><input type="text" name="nickName" value="${page.condition.nickName }"/></td>
				</tr>
				<tr>
					<td>电话：</td>
					<td><input type="text" name="phone" value="${page.condition.phone }" /></td>
					<td>角色：</td>
					<td>
						<select name="roleId">
							<option value="">未选择</option>
							<c:forEach var="role" items="${roleList}">
								<option value="${role.roleId}" <c:if test="${role.roleId ==page.condition.roleId }">selected</c:if>>${role.description}</option>
							</c:forEach>
						</select>
						
					</td>
					<td>创建日期：</td>
					<td><input class="date" name="createDateStartStr" value="<fmt:formatDate value='${page.condition.createDateStart }' pattern='yyyy-MM-dd HH:mm:ss'/>"
						dateFmt="yyyy-MM-dd HH:mm:ss" readonly="true" /> - <input
						class="date" name="createDateEndStr" dateFmt="yyyy-MM-dd HH:mm:ss" value="<fmt:formatDate value='${page.condition.createDateEnd }' pattern='yyyy-MM-dd HH:mm:ss'/>"
						readonly="true" />
					</td>
					<td>
						是否启用
					</td>
					<td>
						<select name="activated">
							<option value="">全部</option>
							<option value="1" <c:if test="${page.condition.activated==1 }">selected</c:if>>启用</option>
							<option value="0" <c:if test="${page.condition.activated==0 }">selected</c:if>>禁用</option>
						</select>
					</td>
				</tr>

			</table>
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">检索</button>
							</div>
						</div>
					</li>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button onclick="formReSet(this)" type="button">重置</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>

<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="admin/user/addUser" rel="userAddTab" title="添加用户" target="navTab"><span>添加</span></a></li>
			<li><a class="delete" href="admin/user/delete" target="selectedTodo"
				title="确定要删除这些用户吗?"><span>删除</span></a></li>
			<li class="line">line</li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="180">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl" title="全选"></th>
				<th width="40">序号</th>
				<th width="80">用户名</th>
				<th width="80">昵称</th>
				<th width="40">性别</th>
				<th width="40">年龄</th>
				<th width="100">邮箱</th>
				<th width="60">电话</th>
				<th width="40">是否启用</th>
				<th width="80">角色</th>
				<th width="100">创建日期</th>
				<th width="80">操作</th>
			</tr>
		</thead>
		<tbody>
			<%
				int i = 0;
			%>
			<c:forEach var="user" items="${page.list}">
				<tr>
					<td>
						<input type="checkbox" id="ids" name="ids" value="${user.userId }" />
					</td>
					<td><%=++i%></td>
					<td><c:out value="${user.userName}"></c:out></td>
					<td><c:out value="${user.nickName}"></c:out></td>
					<td><c:out value="${user.sex}"></c:out></td>
					<td><c:out value="${user.age}"></c:out></td>
					<td><c:out value="${user.email}"></c:out></td>
					<td><c:out value="${user.phone}" /></td>
					<td><c:if test="${user.activated ==1}">已启用</c:if><c:if test="${user.activated==0 }">已禁用</c:if></td>
					<td>
						<c:out value="${user.role.description}" />
					</td>
					<td><fmt:formatDate value='${user.createDate}' pattern='yyyy-MM-dd HH:mm:ss'/></td>
					<td>
						<a class="btnDel" href="admin/user/delUser?userId=${user.userId }" target="ajaxTodo" title="确定要删除用户【${user.nickName }】吗？">删除</a>
					 	<a class="btnEdit" href="admin/user/modifyUser?userId=${user.userId } " title="编辑用户" rel="editUser" target="dialog">编辑</a>
					 	<c:if test="${user.activated==1 }">
					 		<a class="btnDisable" href="admin/user/useOrNot?oper=0&userId=${user.userId } " target="ajaxTodo" title="确定要禁用用户【${user.nickName }】吗？">禁用</a>
					 	</c:if>
					 	<c:if test="${user.activated==0 }">
					 		<a class="btnActive" href="admin/user/useOrNot?oper=1&userId=${user.userId } " target="ajaxTodo" title="确定要启用用户【${user.nickName }】吗？">启用</a>
					 	</c:if>
					 </td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="10" <c:if test="${page.pageSize==10 }">selected</c:if>>10</option>
				<option value="20" <c:if test="${page.pageSize==20 }">selected</c:if>>20</option>
				<option value="50" <c:if test="${page.pageSize==50 }">selected</c:if>>50</option>
				<option value="100" <c:if test="${page.pageSize==100 }">selected</c:if>>100</option>
				<option value="200" <c:if test="${page.pageSize==200 }">selected</c:if>>200</option>
			</select>
			<span>条，共${page.totalCount}条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="${page.totalCount }" numPerPage="${page.pageSize}" pageNumShown="5" currentPage="${page.pageNo}"></div>

	</div>
</div>